package com.hup.htts.view;

import com.hup.utils.swing.customView.ImageButton;

import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.border.TitledBorder;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

/**
 * @author hugan
 * @date 2021/9/12
 */
public class MainForm {
    public JPanel root;

    public ImageButton btnSetting;
    public ImageButton btnHide;
    public ImageButton btnExit;

    public JComboBox<String> cbbVoice;
    public JSlider slSpeed;
    public JLabel txtTitle;
    public ImageButton btnSpeak;

    {
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
        $$$setupUI$$$();
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        root = new JPanel();
        root.setLayout(new GridBagLayout());
        root.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
        final JPanel panel1 = new JPanel();
        panel1.setLayout(new GridBagLayout());
        GridBagConstraints gbc;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.fill = GridBagConstraints.BOTH;
        root.add(panel1, gbc);
        btnHide = new ImageButton();
        btnHide.setIcon(new ImageIcon(getClass().getResource("/img/icon_hide.png")));
        btnHide.setToolTipText("隐藏");
        gbc = new GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = 0;
        panel1.add(btnHide, gbc);
        btnExit = new ImageButton();
        btnExit.setIcon(new ImageIcon(getClass().getResource("/img/icon_exit.png")));
        btnExit.setToolTipText("关闭");
        gbc = new GridBagConstraints();
        gbc.gridx = 3;
        gbc.gridy = 0;
        panel1.add(btnExit, gbc);
        txtTitle = new JLabel();
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.weightx = 1.0;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 0, 0);
        panel1.add(txtTitle, gbc);
        btnSetting = new ImageButton();
        btnSetting.setIcon(new ImageIcon(getClass().getResource("/img/icon_setting.png")));
        btnSetting.setToolTipText("设置");
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        panel1.add(btnSetting, gbc);
        final JPanel panel2 = new JPanel();
        panel2.setLayout(new GridBagLayout());
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.fill = GridBagConstraints.BOTH;
        root.add(panel2, gbc);
        panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
        cbbVoice = new JComboBox();
        final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
        defaultComboBoxModel1.addElement("无语音引擎");
        cbbVoice.setModel(defaultComboBoxModel1);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.gridwidth = 2;
        gbc.weightx = 1.0;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        panel2.add(cbbVoice, gbc);
        final JLabel label1 = new JLabel();
        label1.setText("语速");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.anchor = GridBagConstraints.WEST;
        panel2.add(label1, gbc);
        slSpeed = new JSlider();
        slSpeed.setMajorTickSpacing(5);
        slSpeed.setMaximum(10);
        slSpeed.setMinimum(-10);
        slSpeed.setPaintTicks(true);
        slSpeed.setValue(0);
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 1;
        gbc.gridwidth = 2;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        panel2.add(slSpeed, gbc);
        btnSpeak = new ImageButton();
        btnSpeak.setCheckbox(true);
        btnSpeak.setIcon(new ImageIcon(getClass().getResource("/img/app_tray.png")));
        btnSpeak.setSelected(true);
        btnSpeak.setToolTipText("启用");
        gbc = new GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = 0;
        panel2.add(btnSpeak, gbc);
    }

    /**
     * @noinspection ALL
     */
    public JComponent $$$getRootComponent$$$() {
        return root;
    }

}
